{#
/**
 * @file
 * Image component for images and background images.
 */
#}
{# SETTINGS #}
{% set variant = variant|default('image') %}

{# TEMPLATES #}
{% if variant == 'image' %}
  {%- set image -%}
    {% if url is not empty %}
      <img {{ img_attributes }} src="{{ file_url(url) }}" alt="{{ alt }}"/>
    {% else %}
      {{- image -}}
    {%- endif -%}
  {% endset %}

  {% include '@atoms/image/_image--image.twig' with {
    image: image,
    caption: caption
  } only %}
{% elseif variant == 'background' %}
  {% include '@atoms/image/_image--background.twig' with {
    url: url,
    background_style: background_style
  } only %}
{% endif %}
